Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| |||||||||||
Interview Questions and Answers - Order By Newest | |||||||||||
| |||||||||||
Ans. Conversion means that the expression / literal / value of one type getting converted to other type. Widening conversion is the conversion from Type A to Type B where B requires a wider space than A. For example - int to long, float to double, char to String etc. As the value moves to a wider space, there is no loss of information. Narrowing conversion is the conversion from Type A to Type B where B requires a narrower space space than A. For example - int to long, float to double, char to String etc.As the value moves to a narrower space, there is a loss of information. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  data type  widening conversion  narrowing conversion | |||||||||||
| |||||||||||
Ans. Boxing conversion converts expressions of primitive type to corresponding expressions of reference type. For example boolean to Boolean long to Long double to Double | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  data type  boxing  wrapper classes | |||||||||||
| |||||||||||
Ans. String is not a primitive type in java. Anything defined within double quotes like "abc" is an object of String class. | |||||||||||
Sample Code for String | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  string  data type Basic | |||||||||||
| |||||||||||
Ans. char is a primitive data type. String is a class. Char is a wrapper class for primitive char. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  char  string  data type Basic | |||||||||||
| |||||||||||
Ans. 5.0 operation between two ints generate int only. so 7/5 generates 1 and not 1.4. Multiplication between int and float generates float and hence 1 * 5.0 = 5.0 | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arithmetic calculation  data types | |||||||||||
| |||||||||||
Ans. if you have similar type of data or objects or entities, then we can give them a type with unique name. And this name will be our Data type. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  data type | |||||||||||
| |||||||||||
Ans. ambiguity error | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  method  function  data types Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. BigDecimal provides more precision as compared to double. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  BigDecimal  Double  data types | |||||||||||
| |||||||||||